import java.util.Arrays;

class Solution {
    public int findContentChildren(int[] g, int[] s) {
        int n = g.length;
        int m = s.length;
        Arrays.sort(g);
        Arrays.sort(s);
        int count = 0;
        int cur1 = 0, cur2 = 0;
        while(cur1 < n && cur2 < m) {
            while(cur2 < m && s[cur2]<g[cur1] ) {
                cur2++;
            }
            if(cur2 == m) break;
            count++;
            cur1++;
            cur2++;
        }

        return count;
    }
}

public class Test {
}
